﻿using Developer.Core.FrameWork.GlobalVar;
using Microsoft.AspNetCore.Builder;
using System;
using System.Collections.Generic;
using System.Text;

namespace Developer.Core.FrameWork.IPLimit
{
    /// <summary>
    /// IP记录扩展类
    /// </summary>
    public static class IPRecordExtensions
    {
        public static void UseIPRecord(this IApplicationBuilder app)
        {
            if (app == null)
                throw new ArgumentNullException(nameof(app));

            // 是否开启IP请求记录
            if (GlobalVars.IsIPLog)
                app.UseMiddleware<IPRecordMiddleWare>();
        }
    }
}
